<?php

/*
 * What php team is that is 'one thing, a team, work together'
 */

namespace App\Traits;

/**
 * Trait ApiTraits.
 */
trait ArrayTrait
{
    /**
     * 处理关联表所需数据
     * 处理关联表所需数据.
     *
     * @param $column
     * @param $originalData
     * @param $fillData
     *
     * @return array
     *
     */
    public function handleRelationData($column, $originalData, $fillData)
    {
        $relationData = [];
        foreach ($originalData as $originalId) {
            $relationData[] = array_merge($fillData, [
                $column  => $originalId,
            ]);
        }

        return $relationData;
    }
}
